package com.nmc.service.manager;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.nmc.common.BirthStatusEnum;
import com.nmc.service.dao.BirthDao;
import com.nmc.service.model.Birth;
import com.nmc.service.model.StatisticsModel;


/**
 * Business Service Interface to handle communication between web and
 * persistence layer.
 */
public interface BirthManager extends GenericManager<Birth, String> {
    /**
     * Convenience method for testing - allows you to mock the DAO and set it on an interface.
     * @param birthDao the BirthDao implementation to use
     */
    void setBirthDao(BirthDao birthDao);

    /**
     * Retrieves a birth by birthId.  An exception is thrown if birth not found
     *
     * @param birthId the identifier for the birth
     * @return Birth
     */
    Birth getBirth(String birthId);

    

    /**
     * Retrieves a list of all births.
     * @return List
     */
    List<Birth> getBirths();

    /**
     * Saves a birth's information.
     *
     * @param birth the birth's information
     * @throws BirthExistsException thrown when birth already exists
     * @return birth the updated birth object
     */
    Birth saveBirth(Birth birth) ;

    /**
     * Removes a birth from the database by their birthId
     *
     * @param birthId the birth's id
     */
    void removeBirth(String birthId);

    public List<Birth> getHospitalBirthList(int hospitalId);
    public List<Birth> getHospitalBirthListByStatus(int hospitalId, BirthStatusEnum submit, int count);
    
    /**
     * Get birth list zone wise for the given zoneId
     * @param zoneId
     * @param submit 
     * @return
     */
    public List<Birth> getZoneBirthListByStatus(int zoneId, BirthStatusEnum submit, int count);
    public List<Birth> getZoneBirthList(Birth birth);
    public List<Birth> searchBirthForAdminUser(Birth birth);
    
    public List<Birth> searchBirth(Birth birth);
    
    public String getNextBirthCounterForHospital(int hospitalId, int year);
    public StatisticsModel getHospitalStatisticsCount(int hospitalId,int months);
    public StatisticsModel getZoneStatisticsCount(int zoneId,int months);
    
    public void updateDeliveryDetails(String id, Birth birth);
    
    /**
     * This method will return total male and female count for the given past months.
     * 
     * @param months (required months -1 ex: for past 6 months argument value should be 6)
     * @return
     */
    public StatisticsModel getMaleFemaleCount(int months);
    
	public Map<String, ArrayList<Integer>> getZoneMaleFemaleCountByMonths(int zoneId ,int months);
	public Map<String, ArrayList<Integer>> getHospitalMaleFemaleCountByMonths(int hospitalId ,int months);
	public List<Object[]> getAllZonesMaleFemaleCounts(int months);
	public StatisticsModel getAllZoneStatisticsCount(int months);
}
